import { CoolController, BaseController } from '@cool-midway/core';
import { Body, Inject, Post, Get } from '@midwayjs/core';
import { FixturesMouldEntity } from '../../entity/mould';
import { FixturesMouldService } from '../../service/mould';

/**
 * 页面装修
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: FixturesMouldEntity,
  service: FixturesMouldService,
  pageQueryOp: {
    keyWordLikeFields: ['name'],
  },
})
export class AdminFixturesMouldController extends BaseController {
  @Inject()
  fixturesMouldService: FixturesMouldService;

  @Post('/getFixturesPreviewCode', { summary: '保存配置' })
  async getFixturesPreviewCode(@Body() body) {
    return this.ok(
      await this.fixturesMouldService.getFixturesPreviewCode(body)
    );
  }

  @Get('/getPlatformPages', { summary: '获取平台页面' })
  async getPlatformPages() {
    return this.ok(await this.fixturesMouldService.getPlatformPages());
  }
}
